import request from '/@/utils/request';

import qs from 'qs'

/**
 * 导入导出服务API
 * @returns 
 */
export function imexportApi() {
	return {

		/**
		 * 管理员-查询导入导出列表
		 * @param params 
		 * @returns 
		 */
		adminQueryTask: (params: any) => {
			return request({
				url: '/COMMON-SERVICE/admin/imexport/task/',
				method: 'get',
				params: params
			});
		},

		/**
		 * 用户-查询导入导出列表
		 * @param params 
		 * @returns 
		 */
		userQueryTask: (params: any) => {
			return request({
				url: '/COMMON-SERVICE/user/imexport/task',
				method: 'get',
				params: params
			});
		},

		downloadFile: (pageType: String, _id: String) => {
			return request({
				url: 'COMMON-SERVICE/' + pageType + '/mongo/gridfs/download',
				method: 'get',
				responseType: 'blob',
				params: { _id: _id }
			})
		},

		/**
		 * 管理员-查询导入导出列表
		 * @param params 
		 * @returns 
		 */
		getExportTemplate: (params: any) => {
			return request({
				url: '/COMMON-SERVICE/admin/export/template/',
				method: 'get',
				params: params
			});
		},

		/**
				 * 管理员-createOrUpdate
				 * @param params 
				 * @returns 
				 */
		createOrUpdateExportTemplate: (params: any) => {
			return request({
				url: '/COMMON-SERVICE/admin/export/template/',
				method: 'post',
				params: params
			});
		},



		imexportTask: (params: any) => {
			return request({
				url: 'KISER-BUSINESS-SERVICE/remot/imexport/task',
				method: 'post',
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
				data: params
			});
		},


	};
}
